part of 'widget.dart';

class _HeaderLabledIconButtonView extends StatelessWidget {
  const _HeaderLabledIconButtonView({
    required this.iconData,
    required this.label,
    required this.onPressed,
  });

  final IconData iconData;
  final String label;
  final VoidCallback onPressed;

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        HoverOver(
          translateXAxis: 0.0,
          translateYAxis: 0.0,
          builder: (isHovered) {
            final color = isHovered
                ? _HeaderLabledIconButtonTheme.of(context).hoveredButtonBackgroundColor
                : null;

            return AppButton(
              onPressed: onPressed,
              borderRadius: BorderRadius.circular(5),
              child: Container(
                height: 24,
                width: 44,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(5),
                  color: color,
                ),
                child: Icon(
                  iconData,
                  size: 22,
                  color: _HeaderLabledIconButtonTheme.of(context).iconColor,
                ),
              ),
            );
          },
        ),
        const SizedBox(
          height: 4,
        ),
        Text(
          label,
          style: _HeaderLabledIconButtonTheme.of(context).textTheme.label,
          textAlign: TextAlign.center,
          textWidthBasis: TextWidthBasis.longestLine,
          maxLines: 1,
        ),
      ],
    );
  }
}
